package sitarflash.states.login;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TextEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import oboe.controllers.Controller;

/**
 * ...
 * @author Felipe Manga
 */

class Login extends Controller
{

	public function new() 
	{
		var asset = new Sprite();
		super( asset );
		
		var login:TextField = new TextField();
		login.autoSize = TextFieldAutoSize.LEFT;
		login.x = 10;
		login.y = 10;
		login.text = "LOGIN";
		login.type = TextFieldType.INPUT;
		asset.addChild( login );
		
		var pass:TextField = new TextField();
		pass.autoSize = TextFieldAutoSize.LEFT;
		pass.x = 10;
		pass.y = 30;
		pass.text = "PASS";
		pass.type = TextFieldType.INPUT;
		pass.displayAsPassword = true;
		asset.addChild( pass );
		
		pass.addEventListener( TextEvent.TEXT_INPUT,
			function( e:TextEvent ):Void
			{
				trace( e.text );
			}
		);
	}
	
	@slot private override function onAddToParent():Void
	{
		super.onAddToParent();
		// this.signalUp("loginSuccess", []);
		this.signalUp("server_logIn", ["bob", "marley"]);
	}
	
}